package com.hupu.jrs.api.forum

import com.hupu.jrs.bean.*
import com.hupu.jrs.db.ThreadInfo
import okhttp3.MultipartBody
import okhttp3.RequestBody
import retrofit2.http.*
import rx.Observable

/**
 * Created by Stark.Tony on 2018/3/18.
 * 论坛相关api
 */
interface ForumService {

    @GET("forums/getForums")
    fun getForums(@Query("sign") sign: String,
                  @QueryMap params: Map<String, String>): Observable<ForumsData>

    @GET("forums/getUserForumsList")
    fun getMyForums(@Query("sign") sign: String,
                    @QueryMap params: Map<String, String>): Observable<MyForumsData>

    @GET("forums/getForumsInfoList")
    fun getThreadsList(
            @Query("sign") sign: String, @QueryMap params: Map<String, String>): Observable<ThreadListData>

    @POST("forums/attentionForumAdd")
    @FormUrlEncoded
    fun addAttention(
            @Query("sign") sign: String, @FieldMap params: Map<String, String>): Observable<AttendStatusData>

    @POST("forums/attentionForumRemove")
    @FormUrlEncoded
    fun delAttention(
            @Query("sign") sign: String, @FieldMap params: Map<String, String>): Observable<AttendStatusData>

    @GET("forums/getForumsAttendStatus")
    fun getAttentionStatus(
            @Query("sign") sign: String, @QueryMap params: Map<String, String>): Observable<AttendStatusData>

    @GET("threads/getThreadsSchemaInfo")
    fun getThreadSchemaInfo(
            @Query("sign") sign: String, @QueryMap params: Map<String, String>): Observable<ThreadSchemaInfo>

    @POST("threads/threadPublish")
    @FormUrlEncoded
    fun addThread(
            @FieldMap params: Map<String, String>): Observable<PostData>

    @POST("threads/threadReply")
    @FormUrlEncoded
    fun addReplyByApp(
            @FieldMap params: Map<String, String>): Observable<PostData>

    @POST("threads/threadCollectAdd")
    @FormUrlEncoded
    fun addCollect(
            @Field("sign") sign: String, @FieldMap params: Map<String, String>): Observable<CollectData>

    @POST("threads/threadCollectRemove")
    @FormUrlEncoded
    fun delCollect(
            @Field("sign") sign: String, @FieldMap params: Map<String, String>): Observable<CollectData>

    @POST("threads/threadReport")
    @FormUrlEncoded
    fun submitReports(
            @Field("sign") sign: String, @FieldMap params: Map<String, String>): Observable<BaseData>

    @GET("recommend/getThreadsList")
    fun getRecommendThreadList(
            @Query("sign") sign: String, @QueryMap params: Map<String, String>): Observable<ThreadListData>

    @GET("user/getUserMessageList")
    fun getMessageList(@Query("sign") sign: String,
                       @QueryMap params: Map<String, String>): Observable<MessageData>

    @POST("user/delUserMessage")
    @FormUrlEncoded
    fun delMessage(
            @Field("sign") sign: String, @FieldMap params: Map<String, String>): Observable<BaseData>

    @POST("img/Imgup")
    @Multipart
    fun upload(@Part file: MultipartBody.Part,
               @PartMap params: Map<String, RequestBody>): Observable<UploadData>

    @GET("permission/check")
    fun checkPermission(@Query("sign") sign: String,
                        @QueryMap params: Map<String, String>): Observable<PermissionData>

    @GET("threads/getsThreadInfo")
    @Headers("Referer:http://bbs.mobileapi.hupu.com/1/7.0.8/threads/getThreadDetailInfoH5")
    fun getThreadInfo(@QueryMap params: Map<String, String>): Observable<ThreadInfo>

    @GET("threads/getsThreadLightReplyList")
    @Headers("Referer:http://bbs.mobileapi.hupu.com/1/7.0.8/threads/getThreadDetailInfoH5")
    fun getThreadLightReplyList(@QueryMap params: Map<String, String>): Observable<ThreadLightReplyData>

    @GET("threads/getsThreadPostList")
    @Headers("Referer:http://bbs.mobileapi.hupu.com/1/7.0.8/threads/getThreadDetailInfoH5")
    fun getsThreadReplyList(@QueryMap params: Map<String, String>): Observable<ThreadReplyData>

    @POST("threads/replyLight")
    @FormUrlEncoded
    @Headers("Referer:http://bbs.mobileapi.hupu.com/1/7.0.8/threads/getThreadDetailInfoH5")
    fun addLight(@FieldMap params: Map<String, String>): Observable<BaseData>

    @POST("threads/replyUnlight")
    @FormUrlEncoded
    @Headers("Referer:http://bbs.mobileapi.hupu.com/1/7.0.8/threads/getThreadDetailInfoH5")
    fun addRuLight(@FieldMap params: Map<String, String>): Observable<BaseData>
}
